<!--
 * @Description:
 * @version:
 * @Author: 尹鹏孝
 * @Date: 2023-03-23 09:55:40
 * @LastEditors: 尹鹏孝
 * @LastEditTime: 2023-03-23 11:04:42
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>set,map</title>
</head>
<body>

<script>
    var engine = new Set(['Gecko','Trident','webkit','webkit']);
    console.log(engine)
    for(let e of engine){
        console.log(e);
    }

    var es6 = new Map();
    es6.set("edition",6);
    es6.set('committee','TC39')
     es6.set('standard', 'ECMA-262')
     for(let [name,value] of es6){
        console.log(name+":"+value)
     }


     const s = new Set();
     [1,2,3,4,4,567,888,888,8888].forEach(x=>s.add(x));

     for(let i of s){
        console.log(i);
     }

     let set =new Set();
     set.add({}).add({});
     console.log(set.has({}));

     const items = new Set([1,2,3,4,5,6]);
     const array = Array.from(items);
     const values = [1, 2, 3, 4, 5].values()
     const keys = [1, 2, 3, 4, 5].keys()
     function dupNation(array){
        //数组去重。
        return Array.from(new Set(array));
     }

    console.log([1233, [1, 2, 3, [123]]].flat(Infinity))


    let arr=[{name:'ypx1',id:11}, { name: 'ypx2', id: 12 }, { name: 'ypx3', id: 13 }]
    // 需要查找id:13
    let newArray=new Map();
    arr.forEach(item=>newArray.set(item.id,item.name));

   console.log(newArray.get(11))

</script>

</body>
</html>